package com.topone.dataObject.Mapper;

import com.topone.dataObject.CouponCategory;
import com.topone.dataObject.TcUser;
import com.topone.dto.TcUserDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * Created by Administrator on 2018/1/4,0004.
 */

public interface UserMapper {


    @Select("select * from tc_user where user_id=#{userId}")
    TcUser findByuserId(Map<String, Object> map);

    @Select("select * from tc_user where user_id=#{userId}")
    TcUser findByObject(TcUser tcUser);

    @Insert("insert into coupon_category(category_name,coupon_type) values(#{categoryName,jdbcType=VARCHAR},#{couponType,jdbcType=INTEGER})")
     int insertByCategory(CouponCategory couponCategory);

    @Select("select * from tc_user where user_id=#{user}")
    @Results({
            @Result(column = "user_id",property = "userId"),
            @Result(column = "openid",property ="openid"),
            @Result(column = "user_name",property = "userName")
    })
    TcUser findById(String user);

    TcUser selectTcUser(String userId);

    //登陆个人中心 查询用户信息
    TcUserDTO findUserInfo(String openid);

    //插入用户
    Integer insertUserInfo(TcUserDTO tcUserDTO);

    Integer updateUserInfo(TcUserDTO tcUserDTO);

    TcUserDTO findUserInfoByOpenid(String openid);

}
